package main

import "fmt"

type Person struct {
	weight int
}

func (p Person) eat(food string) {
	fmt.Println("正在吃：", food)
}

type Address struct {
	city string
}

func (a Address) showCity() {
	fmt.Println(a.city)
}

type Student struct {
	Person         //类似于继承关系
	addr   Address //类似于增加了某个属性
	name   string
	age    int
}

func main() {
	st1 := Student{
		Person: Person{weight: 100},
		addr:   Address{city: "beijing"},
		name:   "zhangsan",
		age:    10,
	}
	fmt.Println(st1)

	//可以执行
	st1.eat("番茄")

	//不能引用到
	//st1.showCity()

}
